Skip to content

docs: warn against nyc instrument --in-place (#861) - #1010

Merged
jennifer-shehane merged 1 commit into
masterfrom
claude/code-coverage-861-reverify-gavh07
Nov 2, 2026
Merged

jennifer-shehane merged 1 commit into
masterfrom
claude/code-coverage-861-reverify-gavh07

Conversation

@jennifer-shehane

@jennifer-shehane jennifer-shehane commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Additional details

nyc instrument --in-place overwrites source files with instrumented code. The HTML reporter (nyc.report() in lib/task.ts) reads source files from disk, so the report shows instrumented code. This is expected nyc behavior, not a plugin bug.

This adds one paragraph to the "Instrument your application" section of README.md. It recommends writing nyc instrument output to a separate folder (for example, nyc instrument src dist-instrumented) and explains why --in-place breaks the report. No code changes.

How I checked it: I instrumented the same file both ways and generated the HTML report with nyc.report(). Both runs record the same coverage key (src/math.js). The --in-place report shows instrumented code, and the separate-folder report shows the original source.

Steps to test

  1. Read the new paragraph under "Instrument your application" in README.md.
  2. Optional: run nyc instrument --in-place src on a sample file, run the code, then run nyc report --reporter=html and confirm the report shows instrumented code. Repeat with nyc instrument src dist-instrumented and confirm the report shows the original source.

How has the user experience changed?

No change. This is a docs-only update.


Generated by Claude Code


Note

Low Risk
Documentation-only change with no runtime or configuration impact.

Overview
Adds guidance in Instrument your application for teams that pre-instrument with nyc instrument: write output to a separate directory (e.g. nyc instrument src dist-instrumented) and serve that build, and avoid --in-place.

The new paragraph explains that in-place instrumentation overwrites sources on disk, and because HTML coverage reports (via the plugin’s nyc.report() flow) show whatever is on disk, reports would display instrumented boilerplate instead of readable source—clarifying expected nyc behavior rather than a plugin defect. Closes #861.

Reviewed by Cursor Bugbot for commit 259a09a. Bugbot is set up for automated code reviews on this repo. Configure here.

`nyc instrument --in-place` overwrites the source files with
instrumented code. The HTML reporter reads sources from disk, so the
report then shows instrumented code. Recommend instrumenting into a
separate folder instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r4ToKpF6R8iwcic9CU
@jennifer-shehane
jennifer-shehane merged commit 6738a67 into master Nov 2, 2026
32 checks passed
@jennifer-shehane
jennifer-shehane deleted the claude/code-coverage-861-reverify-gavh07 branch November 2, 2026 00:02
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 4.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NYC instrumentation report contains instrumented files

2 participants